home *** CD-ROM | disk | FTP | other *** search
- package ui
- {
- import flash.display.MovieClip;
- import flash.events.Event;
- import flash.events.MouseEvent;
-
- [Embed(source="/_assets/assets.swf", symbol="ui.UIButton")]
- public class UIButton extends MovieClip
- {
-
-
- public var _tHolder:MovieClip;
-
- private var _roll:Boolean;
-
- public var _hit:MovieClip;
-
- public function UIButton()
- {
- super();
- _hit.alpha = 0;
- _hit.addEventListener(MouseEvent.CLICK,onHitClick);
- _hit.addEventListener(MouseEvent.MOUSE_OVER,onHitOver);
- _hit.addEventListener(MouseEvent.MOUSE_OUT,onHitOut);
- addEventListener("enterFrame",onUIButtonEnterFrame);
- buttonMode = true;
- }
-
- private function onUIButtonEnterFrame(event:*) : *
- {
- if(_roll)
- {
- _hit.alpha += (1 - _hit.alpha) * 0.25;
- }
- else
- {
- _hit.alpha += (0 - _hit.alpha) * 0.25;
- }
- }
-
- private function onHitOver(event:*) : *
- {
- _roll = true;
- }
-
- private function onHitOut(event:*) : *
- {
- _roll = false;
- }
-
- protected function onHitClick(event:*) : *
- {
- dispatchEvent(new Event("CLICK"));
- }
- }
- }
-